'''
Created on Mar 3, 2009

@author: whaleyr
'''
import unittest
import gradeProcs
import models


class Test(unittest.TestCase):


    def testGetLeterGrade(self):
      self.assertEqual('A',gradeProcs.getLetterGrade(91))
      self.assertEqual('A',gradeProcs.getLetterGrade(100))
      self.assertEqual('B',gradeProcs.getLetterGrade(89.9))
      self.assertNotEqual('F',gradeProcs.getLetterGrade(79.9))
      pass
    
    def testGetPoints(self):
      self.assertEqual(4, gradeProcs.getPoints('A'))
      self.assertEqual(3, gradeProcs.getPoints('B'))
      pass
    
    def testGetLetterGrade(self):
      testCourse = models.Course(title="test course", hours=4.0, key_name="c1")
      assignment1 = models.Assignment(name="ass 1", score=8.0, possible=10.0, amountOfCorpus=50.0, course=testCourse)
      assignment2 = models.Assignment(name="ass 2", score=72.0, possible=100.0, amountOfCorpus=50.0, course=testCourse)
      gradeProcs.gradeRecalc(testCourse)
      self.assertEqual("C", testCourse.grade)
      pass


if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testName']
    unittest.main()